<?php
/**
 * Created by PhpStorm.
 * User: 15814
 * Date: 2018/10/7
 * Time: 21:14
 */
//要使用session就要先开启
header("Access-Control-Allow-Origin:*");
header("Content-type:application/json");
session_start();
$res=array("stu"=>0,"msg"=>"您还未登录,请先登陆");
if ($_SERVER["REQUEST_METHOD"]=="POST"){
    if (isset($_SESSION["userInfo"])){
             $res["stu"]=1;
             $res["msg"]="欢迎您";
             $res["data"]=$_SESSION["userInfo"];
             print_r(json_encode($res));
    }
    else{
        print_r(json_encode($res));
    }
}
else{
    $res["stu"]=-1;
    $res["msg"]="请求方式错误";
    print_r(json_encode($res));
}
